//
//  GoodsManageTableViewCell.m
//  Shengzhuli
//
//  Created by subook on 16/8/11.
//  Copyright © 2016年 kamangkeji. All rights reserved.
//

#import "GoodsManageTableViewCell.h"
#import <UIImageView+WebCache.h>

@interface GoodsManageTableViewCell()

@property (weak, nonatomic) IBOutlet UIImageView *goodsIconView;
@property (weak, nonatomic) IBOutlet UILabel *goodsNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *goodsPriceLabel;
@property (weak, nonatomic) IBOutlet UILabel *subTitle;
@property (weak, nonatomic) IBOutlet UIButton *acceptBtn;

@end
@implementation GoodsManageTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setModel:(GoodsManageModel *)model
{
    _model = model;
    [self.goodsIconView sd_setImageWithURL:[NSURL URLWithString:model.thumbnailUrl] placeholderImage:GetImage(@"default_goods_image")];
    self.goodsNameLabel.text = model.name;
    self.goodsPriceLabel.text = [NSString stringWithFormat:@"¥%@",model.price];
}

- (void)setUserModel:(EaseUserModel *)userModel
{
    _userModel = userModel;
    [self.goodsIconView sd_setImageWithURL:[NSURL URLWithString:userModel.avatarURLPath] placeholderImage:GetImage(@"default_goods_image")];
    self.goodsNameLabel.text = userModel.nickname;
    self.subTitle.text = userModel.buddy;
    self.goodsPriceLabel.textColor = [UIColor grayColor];
    self.goodsPriceLabel.text = userModel.personalizedSignature;
    if (userModel.isApply) {
        self.acceptBtn.hidden = NO;
    }else{
        self.acceptBtn.hidden = YES;
    }
}
- (IBAction)acceptClick:(UIButton *)btn
{
    if (self.agreeAddBlock) {
        self.agreeAddBlock(self.userModel,btn);
    }
}

@end
